home *** CD-ROM | disk | FTP | other *** search
- /*
- /// Bork.AMIRX v2.0
- \\\ Originally written by Andrew Rooney (IRC: Dustbin) dustbin@hp9000.eita8net.com
- /// Updated by John Oberg (IRC: Kuda) kuda@mindless.com
- \\\ Much of this script ripped off from Ariel Magnum's re-write of aminetfind.gvrexx :)
- ///
- \\\ Extended cmd parsing and handling
- /// so you can now use the AmIRC RAW output commands as :
- \\\ /bork "Hello there!" raw notice Kuda
- /// will send the results to me via notice but will not be displayed on your
- \\\ amirc lister(hence RAW).
- ///
- \\\ Usage:
- /// /alias bork rx bork.amirx %p
- \\\ /bork "Text to be Encheferized" [output]
- ///
- \\\ Output is the command that will be launched with the results as the argument
- ///
- \\\ Examples:
- /// /bork "Hello there" echo
- \\\ «Bork» | Hellu zeere-a
- /// ...
- \\\
- /// Other examples:
- \\\ /bork "Hello there" msg josef - sends output in a message to josef
- /// /bork "Hello there" say - sends output to the channel
- \\\ /bork "Hello there" me - sends output to the channel as an action
- /// /bork "Hello there" topic - sets channel topic to "Hellu zeere-a"
- \\\
- /// Notes:
- \\\ o You MUST put the text to be encheferized in quotes.
- /// o Quotes must be " quotes, not ' quotes.
- \\\ o - options MUST be the last options on the line.
- /// o output defaults to echo
- \\\
- /// Hints:
- \\\ Here's how I've got my script set up...
- /// /alias borks /rx bork.amirx "%p" say - sends output to channel without having to put text in quotes
- \\\ /alias borke /rx bork.amirx "%p" - echos output to screen without having to put text in quotes
- /// /alias borka /rx bork.amirx "%p" me - sends output to chan. as action (no need for quotes)
- \\\ /alias bork /rx bork.amirx %p - for everything else (gotta use quotes with this one)
- (*/
-
- if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then do
- 'echo P=«Aminet» You need rexxsupport.library version 30 or greater in libs:'
- exit 10
- end
-
- bold=d2c(2)
-
- parse arg cmds
- if index(cmds,'"')>0 then do
- parse var cmds '"'text'"' cmd
- end
- else do
- parse var cmds text' 'cmd
- end
-
- if cmd='' then cmd='echo'
- text=strip(text)
- otext='Borking: '
- otext=otext||bold||text||bold
- cmd=strip(cmd)
- if cmd~='' then otext=otext||', output command 'bold||cmd||bold
- otext=otext||'.'
- if address()='REXX' then say 'Borking 'name
- else 'echo P=«Bork» 'otext
-
- outcmd=cmd
- Select
- when upper(outcmd)='ECHO' then outcmd='ECHO P=«Bork»'
- when pos('RAW',upper(outcmd))=1 then do
- parse var outcmd . tcmd tnick
- outcmd='RAW' tcmd tnick ':'
- end
- when upper(outcmd)~='SAY' then outcmd='SAY /'outcmd
- otherwise
- end
-
- If Exists('T:AmIRCBork1') then do
- If ~Delete('T:AmIRCBork1') then say ECHO BORK: Unable to delete file T:AmIRCBork1'
- End
-
- If Exists('T:AmIRCBork2') then do
- If ~Delete('T:AmIRCBork2') then say ECHO BORK: Unable to delete file T:AmIRCBork2'
- End
-
- If Open(file,'T:AmIRCBork1',W) then do
- Call Writeln(file,text)
- Call Close(file)
- Address command 'C:Chef <T:AmIRCBork1 >T:AmIRCBork2'
- If Open(file,'T:AmIRCBork2') then do
- Bork = Readln(File)
- outcmd' 'bork
- Call Close(File)
- Exit
- End
- Else do
- 'ECHO BORK: Unable to open temp file T:AmIRCBork2 (readmode)'
- Exit
- End
- End
- Else do
- 'ECHO BORK: Unable to open temp file T:AmIRCBork1 (write mode)'
- Exit
- End
-